# Contributor (MSYS2): David Macek <david.macek.0@gmail.com>
# Maintainer (Arch Linux): Lukas Fleischer <archlinux at cryptocrack dot de>
# Contributor (Arch Linux): Allan McRae <allan@archlinux.org>
# Contributor (Arch Linux): bekks <eduard.warkentin@gmail.com>
# Contributor (Arch Linux): Daniel J Griffiths <ghost1227@archlinux.us>

pkgname=upx
pkgver=3.91
pkgrel=1
pkgdesc='Ultimate executable compressor.'
arch=('i686' 'x86_64')
url='http://upx.sourceforge.net/'
license=('GPL')
depends=('ucl' 'zlib')
makedepends=('ucl-devel' 'zlib-devel')
source=("http://upx.sourceforge.net/download/${pkgname}-${pkgver}-src.tar.bz2"
        'http://downloads.sourceforge.net/sevenzip/lzma465.tar.bz2')
md5sums=('c6d0b3ea2ecb28cb8031d59a4b087a43'
         '29d5ffd03a5a3e51aef6a74e9eafb759')

build() {
  cd "${pkgname}-${pkgver}-src"
  CPPFLAGS+=" -DUCL_NO_ASM"
  make UPX_LZMA_VERSION=0x465 UPX_LZMADIR="${srcdir}" all
}

package() {
  cd "${pkgname}-${pkgver}-src"

  install -Dm0755 src/upx.out "${pkgdir}/usr/bin/upx"
  install -Dm0644 doc/upx.1 "${pkgdir}/usr/share/man/man1/upx.1"
  install -Dm0644 LICENSE "${pkgdir}/usr/share/license/${pkgname}/LICENSE"
}
